﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using CrystalDecisions.CrystalReports.Engine;

namespace VSS_AHT.ReportForms
{
    public partial class FormPrintPreview : BaseForm
    {
        ReportDocument _report;
        public FormPrintPreview(object report)
        {
            InitializeComponent(); 
            
		_report = report as ReportDocument;
            crystalReportViewer1.ReportSource = _report;
            

            this.btnPrint.Click += new EventHandler(btnPrint_Click);
        }

        void btnPrint_Click(object sender, EventArgs e)
        {
            try
            {
                _report.PrintToPrinter(1, false, 0, 0);
                MessageBox.Show("In thành công");
            }
            catch (Exception ex)
            {
                MessageBox.Show("Lỗi in : " + ex.Message);
            }
            //crystalReportViewer1.PrintReport();
        }
    }
}